package org.xdq.test;

public class Container {

    private int size;
    private int cap;

    public Container(int cap){
        this.cap = cap;
        this.size = 0;

    }

    public void add(){
        size++;
        System.out.println(Thread.currentThread().getName()+":放入面包，数量为"+size);
    }

    public void remove(){
        size--;
        System.out.println(Thread.currentThread().getName()+":取出面包，数量为"+size);
    }

    public boolean isEmpty(){
        return size == 0;
    }

    public boolean isFull(){
        return size == cap;
    }
}
